package com.senlingspace.web.controller.pos;

import com.alibaba.fastjson2.JSON;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.enums.OrderSource;
import com.senlingspace.system.service.ISlkjFareSchemeService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * 门店收银台
 *
 * @author lebronjames
 * @date 2024/07/29
 */
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping(path = "/pos/api")
public class SlkjPosCashiersController extends BaseController {

    private final ISlkjFareSchemeService iSlkjFareSchemeService;


    /**
     * 项目
     *
     * @param shopId
     * @return {@link AjaxResult }
     */
    @GetMapping(path = "/projects")
    public AjaxResult projects(@RequestParam Long shopId) {
        log.info("获取门店 [{}] 当前正在上映的项目门店价格信息！", shopId);
        if (Objects.isNull(shopId)) {
            return error("参数不能为空！");
        }
        AjaxResult projects = iSlkjFareSchemeService.projects(shopId, OrderSource.SHOP.getCode());
        log.info("门店 [{}] 价格信息：{}", shopId, JSON.toJSONString(projects));
        return projects;
    }

}
